package com.epam.command.load;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.epam.command.logic.Command;
import com.epam.dao.DAOFactory;
import com.epam.dao.DAOFactory.DAOType;
import com.epam.dao.intf.IUserDAO;
import com.epam.entity.User;
import com.epam.util.ConfigurationManager;

public class LoadUserCommand implements Command {
	
	@Override
	public String execute(HttpServletRequest request,
			HttpServletResponse response) {
		
		String page = ConfigurationManager.getConfig(ConfigurationManager.USER_MANAGER);
	
		IUserDAO userdao = (IUserDAO) DAOFactory.INSTANCE.getDAO(DAOType.USER);
		User user = userdao.findByLogin(request.getParameter("login"));
		request.setAttribute("user", user);
		
		return page;
		
	}
	
	

}
